import request from '@/utils/request.js'

/**
 * 获取文章分类
 * @returns 
 */
export const artGetChannelsService = () =>{
  return request.get('/my/cate/list')
}

/**
 * 添加文章分类
 * @returns 
 */
export const artAddChannelService = (data) =>{
  return request.post('/my/cate/add', data)
}

/**
 * 编辑文章分类
 * @returns  
 */
export const atrEditChannelService = (data) =>{
  return request.put('/my/cate/info', data)
}

/**
 * 删除文章分类
 * @param {*} id 
 * @returns 
 */
export const artDelChannelService = (id) =>{
  return request.delete('/my/cate/del', {
    params:{
      id
    }
  })
}

/**
 * 获取文章列表
 * @param {*} params 对象
 * @returns 
 */
export const artGetListService = (params) =>{
  return request.get('/my/article/list', {
    params
  })
}

/**
 * 发布文章
 * @param {*} data 需要是一个formData格式对象
 * @returns 
 */
export const artPublishService = (data) =>{
  return request.post('/my/article/add', data)
}

/**
 * 获取文章详情
 * @param {*} id 基于id获取文章详情，完成文章编辑
 */
export const artGetDetailService = (id) =>{
  return request.get('/my/article/info',{
    params: {id}
  })
}

/**
 * 编辑文章提交
 * @param {*} data 
 * @returns 
 */
export const artEditService = (data) => {
  return request.put('/my/article/info', data)
}

/**
 * 删除文章
 * @param {*} id 
 */
export const artDelService = (id) => {
  return request.delete('/my/article/info', {
    params: {
      id
    }
  })
}